/**
    Copyright (c) 2010-2011 yakiimo02
    Distributed under the New BSD License.
    See included license.txt or http://www.yakiimo3d.com/NewBSDLicense.txt
**/

#pragma once

#include "MandelbrotBase.h"

class DataBufferDX11;

/**    
    @brief  Direct Compute implemention of the Mandelbrot fractal.
    @date   2010/01/30
*/
class MandelbrotDirectCompute : public MandelbrotBase
{
public:
    MandelbrotDirectCompute();
    ~MandelbrotDirectCompute();

    HRESULT OnCreateDevice( ID3D11Device* pd3dDevice );
    HRESULT OnResizedSwapChain( ID3D11Device* pd3dDevice, DataBufferDX11* pDataBuffer );
    void    OnFrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext,
                                  double fTime, float fElapsedTime, void* pUserContext );
    void    OnDestroyDevice();

protected:
    HRESULT CompileShaders( ID3D11Device* pd3dDevice );

protected:
    ID3D11ComputeShader*        m_pCS;                // compute shader
    ID3D11UnorderedAccessView*  m_pUAV;               // unordered ascess view
    int                         m_nWidth;             // mandelbrot texture width
    int                         m_nHeight;            // mandelbrot texture height
    ID3D11Buffer*               m_pConstantBuf;       // Constant buffer for passing parameters
};